package com.liuchuanzheng.lcz_wanandroid.net.common

import com.liuchuanzheng.lcz_wanandroid.module.home.bean.Article
import com.liuchuanzheng.lcz_wanandroid.module.home.bean.Category
import com.liuchuanzheng.lcz_wanandroid.module.home.bean.Pagination
import com.liuchuanzheng.lcz_wanandroid.module.user.bean.UserInfo
import retrofit2.http.*

interface MainApi {
    @GET("/article/top/json")
    suspend fun getTopArticleList(): CommonResultBean<List<Article>>

    @GET("/article/list/{page}/json")
    suspend fun getArticleList(@Path("page") page: Int): CommonResultBean<Pagination<Article>>
    @POST("lg/collect/{id}/json")
    suspend fun collect(@Path("id") id: Long): CommonResultBean<Any>

    @POST("lg/uncollect_originId/{id}/json")
    suspend fun uncollect(@Path("id") id: Long): CommonResultBean<Any>

    @GET("lg/collect/list/{page}/json")
    suspend fun getCollectArticleList(@Path("page") page: Int): CommonResultBean<Pagination<Article>>

    @GET("/article/listproject/{page}/json")
    suspend fun getProjectList(@Path("page") page: Int): CommonResultBean<Pagination<Article>>
    @GET("project/tree/json")
    suspend fun getProjectCategories(): CommonResultBean<MutableList<Category>>

    @GET("project/list/{page}/json")
    suspend fun getProjectListByCid(
        @Path("page") page: Int,
        @Query("cid") cid: Int
    ): CommonResultBean<Pagination<Article>>
    @FormUrlEncoded
    @POST("user/login")
    suspend fun login(
        @Field("username") username: String,
        @Field("password") password: String
    ): CommonResultBean<UserInfo>
}